Google Calendar Event Reminder
工作流概述
这是一个包含9个节点的复杂工作流,主要用于自动化处理各种任务。
工作流源代码
{
"id": "SvYHgLmzosuLAe4A",
"meta": {
"instanceId": "a4bfc93e975ca233ac45ed7c9227d84cf5a2329310525917adaf3312e10d5462",
"templateCredsSetupCompleted": true
},
"name": "Google Calendar Event Reminder",
"tags": [],
"nodes": [
{
"id": "dff5d952-23cb-4822-9aec-0dcae3de568a",
"name": "Schedule Trigger",
"type": "n8n-nodes-base.scheduleTrigger",
"disabled": true,
"position": [
-40,
300
],
"parameters": {
"rule": {
"interval": [
{
"field": "minutes",
"minutesInterval": 1
}
]
}
},
"typeVersion": 1.2
},
{
"id": "a6de9944-1dd7-430e-a1d9-100710ddfa9c",
"name": "OpenAI Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
700,
500
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "CDX6QM4gLYanh0P4",
"name": "OpenAi account"
}
},
"typeVersion": 1.2
},
{
"id": "6d2208a6-6000-4b6b-a82c-e346b7885409",
"name": "Get upcoming event",
"type": "n8n-nodes-base.googleCalendar",
"position": [
240,
300
],
"parameters": {
"limit": 5,
"options": {},
"timeMax": "={{ $now.plus({ hour: 1, minute:1 }) }}",
"timeMin": "={{ $now.plus({ hour: 1 }) }}",
"calendar": {
"__rl": true,
"mode": "list",
"value": "davide.boizza@gmail.com",
"cachedResultName": "davide.boizza@gmail.com"
},
"operation": "getAll"
},
"credentials": {
"googleCalendarOAuth2Api": {
"id": "8RFK3u13g2PJEGa9",
"name": "Google Calendar account"
}
},
"typeVersion": 1.3
},
{
"id": "e6f6e744-60b0-4b22-93bc-f3ffcfac71f6",
"name": "Already sent?",
"type": "n8n-nodes-base.removeDuplicates",
"position": [
480,
300
],
"parameters": {
"options": {},
"operation": "removeItemsSeenInPreviousExecutions",
"dedupeValue": "={{ $json.id }}"
},
"typeVersion": 2
},
{
"id": "882d08f5-790a-40bb-bda5-60744d587633",
"name": "Secretary Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
720,
300
],
"parameters": {
"text": "=These are the details of the event/appointment:
Event Name: {{ $('Get upcoming event').item.json.summary }}
Description: {{ $('Get upcoming event').item.json.description }}
Location: {{ $('Get upcoming event').item.json.location }}
Start: {{ $('Get upcoming event').item.json.start.dateTime }}
End: {{ $('Get upcoming event').item.json.end.dateTime }}
Created by: {{ $('Get upcoming event').item.json.creator.email }}",
"options": {
"systemMessage": "=## Core Identity
You are a professional and friendly virtual secretary, dedicated to reminder appointments with efficiency and a warm personal touch.
## Communication Style
- Communicate in a conversational, approachable manner
- Maintain a balance between professional competence and friendly rapport
- Use a tone that is informal yet precise
- Inject occasional light humor and personality into interactions
## Key Responsibilities
1. Calendar Management
- Provide timely reminders and scheduling updates
2. Communication Approach
- Respond promptly and clearly
- Maintain confidentiality and discretion
## Interaction Guidelines
- Use a friendly, conversational tone
- Just describe the details of the event without asking questions
## Tone and Language
- Warm and approachable
- Professional but not overly formal
- Direct and clear in communication
- Use simple, straightforward language
- Show genuine care and attentiveness
Remember: Your primary goal is to make the user's life easier, more organized, and less stressful through efficient and friendly administrative support."
},
"promptType": "define",
"hasOutputParser": true
},
"typeVersion": 1.8
},
{
"id": "82509a0f-9086-423e-8928-f882e59333b8",
"name": "Send reminder",
"type": "n8n-nodes-base.telegram",
"position": [
1100,
300
],
"webhookId": "dbb6a96e-db3b-4827-9455-a91007b89616",
"parameters": {
"text": "={{ $json.output }}",
"chatId": "CHAT_ID",
"additionalFields": {
"appendAttribution": false
}
},
"credentials": {
"telegramApi": {
"id": "0hSq9VwaiJifiscT",
"name": "Telegram account"
}
},
"typeVersion": 1.2
},
{
"id": "d08dd565-4718-4fbc-af7c-7a2e042c96f8",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-40,
-140
],
"parameters": {
"color": 3,
"width": 620,
"content": "## Google Calendar Event Reminder
This smart **Google Calendar** workflow fixes that by sending you a clear, friendly reminder exactly **1 hour before your event starts**—delivered through **Telegram** as if a personal assistant were looking out for you. Powered by **AI**, it transforms cold calendar alerts into warm, conversational nudges you won't ignore."
},
"typeVersion": 1
},
{
"id": "7a9379ca-f301-40b9-ae90-742663bbcdf2",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-40,
40
],
"parameters": {
"width": 620,
"height": 140,
"content": "## STEP 1
- In the \"Get upcoming event\" node enter how much time before the event starts you want to be notified. It is currently set to 1 hour
- In the Telegram node replace CHAT_ID with that of your personal Bot"
},
"typeVersion": 1
},
{
"id": "d7852912-6501-4a1b-8928-6eb890e4aea8",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
420,
240
],
"parameters": {
"width": 220,
"height": 200,
"content": "Prevent multiple reminders for the same event"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"timezone": "Europe/Rome",
"callerPolicy": "workflowsFromSameOwner",
"executionOrder": "v1"
},
"versionId": "d0dd74db-e96c-4a09-a8d1-6fb193b6e015",
"connections": {
"Already sent?": {
"main": [
[
{
"node": "Secretary Agent",
"type": "main",
"index": 0
}
]
]
},
"Secretary Agent": {
"main": [
[
{
"node": "Send reminder",
"type": "main",
"index": 0
}
]
]
},
"Schedule Trigger": {
"main": [
[
{
"node": "Get upcoming event",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "Secretary Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Get upcoming event": {
"main": [
[
{
"node": "Already sent?",
"type": "main",
"index": 0
}
]
]
}
}
}
功能特点
- 自动检测新邮件
- AI智能内容分析
- 自定义分类规则
- 批量处理能力
- 详细的处理日志
技术分析
节点类型及作用
- Scheduletrigger
- @N8N/N8N Nodes Langchain.Lmchatopenai
- Googlecalendar
- Removeduplicates
- @N8N/N8N Nodes Langchain.Agent
复杂度评估
配置难度:
维护难度:
扩展性:
实施指南
前置条件
- 有效的Gmail账户
- n8n平台访问权限
- Google API凭证
- AI分类服务订阅
配置步骤
- 在n8n中导入工作流JSON文件
- 配置Gmail节点的认证信息
- 设置AI分类器的API密钥
- 自定义分类规则和标签映射
- 测试工作流执行
- 配置定时触发器(可选)
关键参数
| 参数名称 | 默认值 | 说明 |
|---|---|---|
| maxEmails | 50 | 单次处理的最大邮件数量 |
| confidenceThreshold | 0.8 | 分类置信度阈值 |
| autoLabel | true | 是否自动添加标签 |
最佳实践
优化建议
- 定期更新AI分类模型以提高准确性
- 根据邮件量调整处理批次大小
- 设置合理的分类置信度阈值
- 定期清理过期的分类规则
安全注意事项
- 妥善保管API密钥和认证信息
- 限制工作流的访问权限
- 定期审查处理日志
- 启用双因素认证保护Gmail账户
性能优化
- 使用增量处理减少重复工作
- 缓存频繁访问的数据
- 并行处理多个邮件分类任务
- 监控系统资源使用情况
故障排除
常见问题
邮件未被正确分类
检查AI分类器的置信度阈值设置,适当降低阈值或更新训练数据。
Gmail认证失败
确认Google API凭证有效且具有正确的权限范围,重新进行OAuth授权。
调试技巧
- 启用详细日志记录查看每个步骤的执行情况
- 使用测试邮件验证分类逻辑
- 检查网络连接和API服务状态
- 逐步执行工作流定位问题节点
错误处理
工作流包含以下错误处理机制:
- 网络超时自动重试(最多3次)
- API错误记录和告警
- 处理失败邮件的隔离机制
- 异常情况下的回滚操作